* mikeOS 16 bit and amd64 baremetal
[mascara-docs.git] / amd64 / bareMetalOS-0.5.2 / baremetal0.5.2 / docs / 5 - BareMetal OS - Build and Install.html
blob4b1aeb6288cb39f7c15da8877870887071aa6001
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <title>BareMetal OS - Application Examples</title>
7 <style type="text/css">
8 body {color:#222; font-family:Verdana,sans-serif; font-size:12px;}
9 pre {background-color:#FAFAFA; border:1px solid #DADADA; margin-bottom:6px; padding:6px;}
10 </style>
11 <script type="text/javascript" src="scripts/shCore.js"></script>
12 <script type="text/javascript" src="scripts/shBrushAsm.js"></script>
13 <script type="text/javascript" src="scripts/shBrushCpp.js"></script>
14 <link type="text/css" rel="stylesheet" href="css/shCore.css"/>
15 <link type="text/css" rel="stylesheet" href="css/shThemeDefault.css"/>
16 <script type="text/javascript">
17 SyntaxHighlighter.defaults['tab-size'] = 8;
18 SyntaxHighlighter.all();
19 </script>
20 </head>
22 <body>
23 <div class="container">
25 <h1>BareMetal OS - Build/Install Instructions</h1>
27 <h3>Version 0.5.2 (DRAFT), 4 July 2011 - Return Infinity</h3>
29 <p>This documentation details how to build the OS and applications from source and also how to install the OS and applications on a Virtual or Phyisical computer.</p>
31 <br />
34 <hr noshade="noshade"></hr>
37 <h2>Overview</h2>
39 <p>.</p>
41 <br />
43 <h3>Building the OS</h3>
45 <p>Building the BareMetal OS kernel only requires one program to be installed: <a href="http://www.nasm.us/">NASM</a>. NASM will compile the Assembly source files into a executable binary file. NASM is also used to compile any applications that are writtin in Assembly. Make sure you are using the latest version of NASM as older versions do not work correctly.</p>
47 <p>Download and extract the BareMetal OS source files to your harddrive. A link to the latest source files is always at the bottom of the BareMetal OS webpage.</p>
49 <pre>nasm kernel64.asm -o kernel64.sys</pre>
51 <br />
53 <h3>Creating a bootable drive</h3>
55 <p>Get an old IDE hard drive (or a compact flash to IDE adapter with a compact flash card).</p>
56 <p>Partition the drive in MBR format with a primary partition. The primary partition needs to be FAT16 (2GiB in size or less). Format the partition with FAT16 and set it as active.</p>
57 <p>Open the hard drive with a hex editor. By default it should load the first sector on the drive (Sector 0).</p>
58 <img src="images/hex1.png"></img>
59 <p>The infomation for the first partition starts at 0x1BE and the LBA start of the partition is a 32-bit value at 0x1C6. 0x80000000 is actually 0x00000008 as it needs to be converted to <a href="http://en.wikipedia.org/wiki/Endian#Examples_of_storing_the_value_0A0B0C0Dh_in_memory">Big-endian</a>. In the example screenshot the first sector of the first partition is 128 (0x80). More information on MBR can be found here: <a href="http://en.wikipedia.org/wiki/Master_boot_record">MBR layout</a></p>
60 <img src="images/hex2.png"></img>
61 <p>Using the hex editor go to the first sector of the first partition. Overwrite bytes 0x3E - 0x1FD of the boot sector with the boot sector from Pure64's FAT16 boot sector (boot16b.bin).</p>
62 <p>Copy pure64.sys and kernel64.sys to the hard drive.</p>
63 <p>Install the hard drive into the computer making sure the hard drive is on the primary IDE channel and that the drive is set to master.</p>
65 The PC should be bootable now.
66 Pure64 will display debug information in the top right corner of the screen during bootup.
67 If you have any issues please email us at support@returninfinity.com.
69 Writing the disk image to a drive
70 Linux uses dd
71 Windows users can use dd for windows
75 <br />
78 <hr noshade="noshade"></hr>
81 <h2>Extra</h2>
83 <a name="license"></a>
84 <h3>License</h3>
86 <p>BareMetal OS is open source and released under the 3-clause "New BSD License" (see <strong>docs/LICENSE.TXT</strong> in the BareMetal OS distribution). Essentially, it means you can do anything you like with the code, including basing your own project on it, providing you retain the license file and give credit to Return Infinity and the BareMetal OS developers for their work.</p>
89 <br />
93 </div>
94 </body>
95 </html>